﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace WanPiJie.Products
{
	public interface ICategoryService
	{
		#region 商品类目相关接口

		/// <summary>
		/// 添加类目信息
		/// </summary>
		/// <param name="thirdCatalogId">类目Id</param>
		/// <param name="catalogName">类目名称</param>
		void AddCatalog(long thirdCatalogId, String catalogName);

		/// <summary>
		/// 更新类目信息
		/// </summary>
		/// <param name="thirdCatalogId">类目Id</param>
		/// <param name="catalogName">类目名称</param>
		void UpdateCatalog(long thirdCatalogId, String catalogName);

		/// <summary>
		/// 是否存在指定的类目信息
		/// </summary>
		/// <param name="thirdCatalogId">类目Id</param>
		/// <returns>true：存在，false：不存在</returns>
		bool HasCatalog(long thirdCatalogId);

		/// <summary>
		/// 获取所有类目信息
		/// </summary>
		/// <returns>返回分类列表信息</returns>
		List<Catalog> GetCatalogs();

		/// <summary>
		/// 根据第三方类目Id获取类目对象
		/// </summary>
		/// <param name="thirdCatalogId">第三方类目Id</param>
		/// <returns></returns>
		Catalog GetCatalogByThirdId(Int64 thirdCatalogId);

		/// <summary>
		/// 获取指定的类目对象
		/// </summary>
		/// <param name="id">类目Id</param>
		/// <returns>指定类目Id的类目对象</returns>
		Catalog GetCatalogById(Int64 id);

		#endregion

		#region Attribute相关

		/// <summary>
		/// 添加属性信息
		/// </summary>
		/// <param name="thirdId">第三方属性Id</param>
		/// <param name="attributeName">属性名称</param>
		void AddAttribute(Int64 thirdId, String attributeName);

		/// <summary>
		/// 更新属性信息
		/// </summary>
		/// <param name="thirdId">第三方属性Id</param>
		/// <param name="attributeName">属性名称</param>
		void UpdateAttribute(Int64 thirdId, String attributeName);

		/// <summary>
		/// 根据Id获取属性信息
		/// </summary>
		/// <param name="id">属性Id</param>
		/// <returns>属性对象</returns>
		WanPiJie.Products.Attribute GetAttributeById(Int64 id);

		/// <summary>
		/// 根据第三方Id获取获取属性对象
		/// </summary>
		/// <param name="thirdId">第三方Id</param>
		/// <returns>属性对象</returns>
		WanPiJie.Products.Attribute GetAttributeByThirdId(Int64 thirdId);

		#endregion

		#region 商品类目属性相关

		/// <summary>
		/// 添加商品属性
		/// </summary>
		/// <param name="catalogId">类目Id</param>
		/// <param name="attributeId">类目属性Id</param>
		/// <param name="attributeName">类目属性名称</param>
		void AddProductAttribute(Int64 catalogId, Int64 attributeId, String attributeName);

		/// <summary>
		/// 更新属性至商品分类
		/// </summary>
		/// <param name="catalogId">类目Id</param>
		/// <param name="attributeId">类目属性Id</param>
		/// <param name="attributeName">类目属性名称</param>
		void UpdateProductAttribute(Int64 catalogId, Int64 attributeId, String attributeName);

		/// <summary>
		/// 是否存在指定的
		/// </summary>
		/// <param name="catalogId"></param>
		/// <param name="attributeId"></param>
		/// <returns></returns>
		bool HasProductAttribute(Int64 catalogId, Int64 attributeId);

		/// <summary>
		/// 获取指定的属性信息
		/// </summary>
		/// <param name="catalogId">类目Id</param>
		/// <param name="attributeId">第三方属性Id</param>
		ProductAttribute GetProductAttribute(Int64 catalogId, Int64 attributeId);

		/// <summary>
		/// 获取指定类目的所有属性信息
		/// </summary>
		/// <param name="catalogId">类目Id</param>
		/// <returns>指定类目Id的所有属性</returns>
		List<ProductAttribute> GetProductAttributes(Int64 catalogId);

		#endregion

		#region 类目属性值相关

		/// <summary>
		/// 添加指定类目指定属性的属性值
		/// </summary>
		/// <param name="catalogId">类目Id</param>
		/// <param name="attributeId">属性Id</param>
		/// <param name="thirdId">属性值Id</param>
		/// <param name="attributeName">属性值名称</param>
		void AddProductAttrVal(Int64 catalogId, Int64 attributeId, Int64 thirdId, String attributeName);

		/// <summary>
		/// 更新指定类目指定属性的属性值
		/// </summary>
		/// <param name="thirdCatalogId">类目Id</param>
		/// <param name="thirdAttributeId">属性Id</param>
		/// <param name="thirdId">属性值Id</param>
		/// <param name="attributeName">属性值名称</param>
		void UpdateProductAttrVal(Int64 catalogId, Int64 attributeId, Int64 thirdId, String attributeName);

		/// <summary>
		/// 是否存在指定的属性值
		/// </summary>
		/// <param name="thirdCatalogId">类目Id</param>
		/// <param name="thirdAttributeId">属性Id</param>
		/// <param name="thirdId">属性值Id</param>
		bool HasProductAttrVal(Int64 catalogId, Int64 attributeId, Int64 thirdId);

		/// <summary>
		/// 获取指定的属性值信息
		/// </summary>
		/// <param name="thirdCatalogId">（第三方）类目Id</param>
		/// <param name="thirdAttributeId">（第三方）属性Id</param>
		/// <param name="thirdId">（第三方）属性值Id</param>
		/// <returns>指定的属性值对象</returns>
		ProductAttributeValue GetProductAttrVal(Int64 catalogId, Int64 attributeId, Int64 thirdId);

		#endregion

		#region 导入接口

		/// <summary>
		/// 导入属性值信息
		/// </summary>
		/// <param name="productAttrVal">属性值对象</param>
		/// <param name="oversee">监视</param>
		void Import(ProductAttributeValue productAttrVal, Action<ProductAttributeValue, string> oversee);

		/// <summary>
		/// 导入Attribute信息
		/// </summary>
		/// <param name="attribute">attribute对象</param>
		/// <param name="oversee">监视</param>
		void Import(Attribute attribute, Action<Attribute, string> oversee);

		/// <summary>
		/// 导入商品属性信息
		/// </summary>
		/// <param name="productAttribute">商品属性对象</param>
		/// <param name="oversee">监视</param>
		void Import(ProductAttribute productAttribute, Action<ProductAttribute, string> oversee);

		#endregion
	}
}
